<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core " %>
<%@include file="./../../../taglibs.jsp"%>
<html>
<head>
    <%@include file="./../../../header.jsp"%>
</head>

	<body class="body">
		
		<a href="javascript:history.go(-1);" class="layui-btn">返回</a>	
		<form class="layui-form layui-form-labelw100" style="width: 500px;margin-top: 30px;">
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>所属社区</label>
				<div class="layui-input-block">
					<select name="" >
				        <option value="">超级管理员</option>
				        <option value="0">一级账户</option>
				        <option value="1">二级账户</option>
				        <option value="2">三级账户</option>
				        <option value="3">其他账户</option>
			      	</select>
				</div>
			</div>	
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>网格名称</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格名称" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>网格总长</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格总长" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>网格长</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格长" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>网格长管理范围</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格长管理范围" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>网格员</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格员" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>大党委成员</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格员" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>两新组织</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格员" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>信息员及<br />信息员管理范围</label>
				<div class="layui-input-block" id="addInfoAss">
					<div class="mb10">
						<div style="display: inline-block;width: 100px;">
							<input type="text" required lay-verify="required" class="layui-input">
						</div>
						<span>---</span>
						<div style="display: inline-block;width: 200px;">
							<input type="text" required lay-verify="required" class="layui-input">
						</div>
					</div>
					<div class="mb10">
						<div style="display: inline-block;width: 100px;">
							<input type="text" required lay-verify="required" class="layui-input">
						</div>
						<span>---</span>
						<div style="display: inline-block;width: 200px;">
							<input type="text" required lay-verify="required" class="layui-input">
						</div>
						<div style="display: inline-block;width: 50px;">
							<button type="button" class="layui-btn layui-btn-primary layui-btn-small removeItem">
							    <i class="layui-icon">&#xe640;</i>
							</button>
						</div>
					</div>
				</div>
				<div class="layui-input-block">
				 	<button type="button" onclick="addInfoAss()" class="layui-btn layui-btn-primary layui-btn-small">
					    <i class="layui-icon">&#xe654;</i>
					</button>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>网格志愿者</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入网格志愿者" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>户数</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入户数" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="must_star">*</i>关注楼院</label>
				<div class="layui-input-block">
					<input type="text" required lay-verify="required" name="请输入关注楼院" class="layui-input">
				</div>
			</div>
			
			
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="reset" class="layui-btn layui-btn-primary">取消</button>
					<button class="layui-btn" type="submit" lay-filter="formSubmit">提交</button>
				</div>
			</div>
		</form>
		
		
		<script type="text/javascript">
			var form = layui.form,
				layer = layui.layer,
				layedit = layui.layedit,
				laydate = layui.laydate

			form.render();
			
			
			
			var ht = '<div class="mb10 addInfoAssItem">'+
						'<div style="display: inline-block;width: 100px;">'+
							'<input type="text" required lay-verify="required" class="layui-input">'+
						'</div>'+
						'<span>---</span>'+
						'<div style="display: inline-block;width: 200px;">'+
							'<input type="text" required lay-verify="required" class="layui-input">'+
						'</div>'+
						'<div style="display: inline-block;width: 50px;">'+
							'<button type="button" class="layui-btn layui-btn-primary layui-btn-small removeItem">'+
							    '<i class="layui-icon">&#xe640;</i>'+
							'</button>'+
						'</div>'+
					'</div>'
			
			
			
			
			//添加信息员及信息员管理范围
			function addInfoAss(){
				$('#addInfoAss').append(ht)
			}
			
			
			
			$('body').delegate("button.removeItem","click",function(){
			  	$(this).parents('.addInfoAssItem').remove()
			});
			
			
			
			
			
			
			
			
			form.on('submit(formSubmit)', function(data){
			    var formData = JSON.stringify(data.field);
			    $.ajax({
			    	type:"post",
			    	url:"",
			    	async:true,
			    	data:formData,
			    	success:function(res){
			    		if(res==0){			//失败
			    			layer.msg('创建失败。。', {icon: 5});
			    		}else if(res==1){	//成功
			    			layer.msg('创建成功。。', {icon: 6});
			    			window.location.reload()
			    		}
			    	},
			    	error:function(){
			    		layer.msg('创建失败。。', {icon: 5});
			    	}
			    });
			    return false;
			});
			
			
		</script>
	
	</body>

</html>